<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
  <script>
    function convert(obj) {
      return new Proxy(obj, {
        get(target, prop) {
          console.log(`getting key "${prop}": ${target[prop]}`);
          return target[prop];
        },
        set(target, prop, value) {
          console.log(`setting key "${prop}" to ${value}`);
          target[prop] = value;
        }
      });
    }
    const obj = { foo: 123 };
    const p = convert(obj);
    p.foo;
    p.foo = 234;
    p.foo;
  </script>
</body>
</html>
